package com.pai4j.pgc.entity;

import jakarta.persistence.*;
import lombok.Data;

import java.util.Date;

/**
 * 创作者审核记录实体类
 *
 * @author: CYM-pai
 * @date: 2025/11/01
 */
@Data
@Entity
@Table(name = "pai4j_creator_audit_record", indexes = {
    @Index(name = "idx_creator_id", columnList = "creator_id"),
    @Index(name = "idx_user_id", columnList = "user_id"),
    @Index(name = "idx_audit_type", columnList = "audit_type"),
    @Index(name = "idx_audit_status", columnList = "audit_status")
})
public class CreatorAuditRecordEntity {
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**
     * 创作者ID
     */
    @Column(name = "creator_id", nullable = false)
    private Long creatorId;
    
    /**
     * 用户ID
     */
    @Column(name = "user_id", nullable = false, length = 64)
    private String userId;
    
    /**
     * 审核类型：1-自动审核 2-人工审核
     */
    @Column(name = "audit_type", nullable = false)
    private Integer auditType;
    
    /**
     * 审核状态：0-待审核 1-审核中 2-已完成
     */
    @Column(name = "audit_status", nullable = false)
    private Integer auditStatus;
    
    /**
     * 审核结果：1-通过 2-拒绝
     */
    @Column(name = "audit_result")
    private Integer auditResult;
    
    /**
     * 审核内容/建议/拒绝原因
     */
    @Column(name = "audit_content", length = 1000)
    private String auditContent;
    
    /**
     * 自动审核得分（0-100）
     */
    @Column(name = "auto_audit_score")
    private Integer autoAuditScore;
    
    /**
     * 审核人（人工审核时填写）
     */
    @Column(name = "audit_by", length = 64)
    private String auditBy;
    
    /**
     * 审核完成时间
     */
    @Column(name = "audit_time")
    private Date auditTime;
    
    /**
     * 创建时间（申请时间）
     */
    @Column(name = "create_date")
    private Date createDate;
    
    /**
     * 备注
     */
    @Column(name = "remark", length = 500)
    private String remark;
    
    @PrePersist
    public void prePersist() {
        if (this.createDate == null) {
            this.createDate = new Date();
        }
        if (this.auditStatus == null) {
            this.auditStatus = 0; // 默认待审核
        }
    }
}




